package com.aurora.source.center.presenter;

import android.content.Context;

import com.aurora.source.base.BaseBean;
import com.aurora.source.base.BasePresenter;
import com.aurora.source.center.view.IBatchSelectView;
import com.aurora.source.constant.AuroraConstants;
import com.aurora.source.home.bean.BatchManagementBean;
import com.aurora.source.util.netutil.SubscriberObserver;

/**
 * @author: ww
 * @description:
 * @date: 2018/10/8
 */
public class BatchSelectPresenter extends BasePresenter<IBatchSelectView>{
    public BatchSelectPresenter(IBatchSelectView baseView) {
        super(baseView);
    }

    public void getBatchList(String userId) {
        requestMethod.getBatchList(userId, new SubscriberObserver<BaseBean<BatchManagementBean>>((Context)baseView,"数据请求中...") {
            @Override
            public void onSuccess(BaseBean<BatchManagementBean> batchManagementBeanBaseBean) {
                if(batchManagementBeanBaseBean.getCode().equals(AuroraConstants.REQUEST_SUCCESS)){
                    baseView.onGetBatchListSuccess(batchManagementBeanBaseBean.getData().getBatchList());
                }else {
                    baseView.onGetBatchFail(batchManagementBeanBaseBean.getMsg());
                }

            }

            @Override
            public void onError(String msg) {
                baseView.onGetBatchFail(msg);
            }

            @Override
            public void onFinish() {

            }
        });
    }
}
